//
//  JBMainController.m
//  JBBasicDataViewModuleController
//
//  Created by Yongbin Zhang on 12/23/13.
//  Copyright (c) 2013 JustBen. All rights reserved.
//

#import "JBEventListController.h"
#import "JBEventListCell.h"

#import "JBDataAPI.h"

@implementation JBEventListController

#pragma mark - init
- (id)init
{
    self = [super init];
    if (self) {
        self.loadCount = 5;
        self.cellNibName = NSStringFromClass([JBEventListCell class]);
    }
    
    return self;
}


//  模版方法
//  重新加载数据
- (void)reloadDataWithSuccess:(void (^)())success failure:(void (^)(NSInteger errorCode, NSString *errorMsg))failure
{
    [super reloadDataWithSuccess:success failure:failure];
    
    [JBDataAPI getEventListOfUser:@"110" withSuccess:^(NSArray *list) {
        [self reloadDataSuccessedWithLastPos:nil dataList:list];
    } failure:^(NSInteger errorCode, NSString *errorMsg) {
        [self reloadDataFailed];
    }];
}


//  模版方法
//  加载更多的数据
- (void)loadMoreDataWithSuccess:(void (^)())success failure:(void (^)(NSInteger errorCode, NSString *errorMsg))failure
{
    [super loadMoreDataWithSuccess:success failure:failure];
    
    [JBDataAPI getEventListOfUser:@"110" withSuccess:^(NSArray *list) {
        [self loadMoreDataSuccessedWithLastPos:nil dataList:list];
    } failure:^(NSInteger errorCode, NSString *errorMsg) {
        [self loadMoreDataFailed];
    }];
}


//  模版方法
//  选中某一行，以该行对应的数据为参数
- (void)selectedCellAtIndexPath:(NSIndexPath *)indexPath
{
    NSLog(@"selected");
}

@end
